package cn.zzuli.springcloud.service.impl;

import cn.zzuli.commons.entity.CommonResult;
import cn.zzuli.commons.entity.Payment;
import cn.zzuli.springcloud.dao.PaymentDao;
import cn.zzuli.springcloud.service.PaymentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class PaymentServiceImpl implements PaymentService {

    @Resource
    PaymentDao paymentDao;

    @Override
    public CommonResult create(Payment payment) {
        int result = paymentDao.create(payment);
        if (result>0){
           return new CommonResult(200,"插入数据库成功",result);
        }
        return new CommonResult(444,"插入数据库失败");
    }



    @Override
    public CommonResult<Payment> getPayMentById(Long id) {
        Payment result = paymentDao.getPayMentById(id);
        if (result == null) {
            return new CommonResult<>(445,"查询数据库失败");
        }else{
            return new CommonResult<>(200,"查询数据库成功",result);
        }
    }
}
